// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyPersistentParticlesAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyPersistentParticlesAttributes
//
// Purpose:
//   This class contains attributes for the PersistentParticles operator.
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a PersistentParticlesAttributes.
//
struct PersistentParticlesAttributesObject
{
    PyObject_HEAD
    PersistentParticlesAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewPersistentParticlesAttributes(int);
std::string
PyPersistentParticlesAttributes_ToString(const PersistentParticlesAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    snprintf(tmpStr, 1000, "%sstartIndex = %d\n", prefix, atts->GetStartIndex());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sstopIndex = %d\n", prefix, atts->GetStopIndex());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sstride = %d\n", prefix, atts->GetStride());
    str += tmpStr;
    const char *startPathType_names = "Absolute, Relative";
    switch (atts->GetStartPathType())
    {
      case PersistentParticlesAttributes::Absolute:
          snprintf(tmpStr, 1000, "%sstartPathType = %sAbsolute  # %s\n", prefix, prefix, startPathType_names);
          str += tmpStr;
          break;
      case PersistentParticlesAttributes::Relative:
          snprintf(tmpStr, 1000, "%sstartPathType = %sRelative  # %s\n", prefix, prefix, startPathType_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    const char *stopPathType_names = "Absolute, Relative";
    switch (atts->GetStopPathType())
    {
      case PersistentParticlesAttributes::Absolute:
          snprintf(tmpStr, 1000, "%sstopPathType = %sAbsolute  # %s\n", prefix, prefix, stopPathType_names);
          str += tmpStr;
          break;
      case PersistentParticlesAttributes::Relative:
          snprintf(tmpStr, 1000, "%sstopPathType = %sRelative  # %s\n", prefix, prefix, stopPathType_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    snprintf(tmpStr, 1000, "%straceVariableX = \"%s\"\n", prefix, atts->GetTraceVariableX().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%straceVariableY = \"%s\"\n", prefix, atts->GetTraceVariableY().c_str());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%straceVariableZ = \"%s\"\n", prefix, atts->GetTraceVariableZ().c_str());
    str += tmpStr;
    if(atts->GetConnectParticles())
        snprintf(tmpStr, 1000, "%sconnectParticles = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sconnectParticles = 0\n", prefix);
    str += tmpStr;
    if(atts->GetShowPoints())
        snprintf(tmpStr, 1000, "%sshowPoints = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sshowPoints = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sindexVariable = \"%s\"\n", prefix, atts->GetIndexVariable().c_str());
    str += tmpStr;
    return str;
}

static PyObject *
PersistentParticlesAttributes_Notify(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetStartIndex(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the startIndex in the object.
    obj->data->SetStartIndex(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetStartIndex(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetStartIndex()));
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetStopIndex(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the stopIndex in the object.
    obj->data->SetStopIndex(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetStopIndex(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetStopIndex()));
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetStride(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the stride in the object.
    obj->data->SetStride(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetStride(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetStride()));
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetStartPathType(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 2)
    {
        std::stringstream ss;
        ss << "An invalid startPathType value was given." << std::endl;
        ss << "Valid values are in the range [0,1]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " Absolute";
        ss << ", Relative";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the startPathType in the object.
    obj->data->SetStartPathType(PersistentParticlesAttributes::PathTypeEnum(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetStartPathType(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetStartPathType()));
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetStopPathType(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 2)
    {
        std::stringstream ss;
        ss << "An invalid stopPathType value was given." << std::endl;
        ss << "Valid values are in the range [0,1]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " Absolute";
        ss << ", Relative";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the stopPathType in the object.
    obj->data->SetStopPathType(PersistentParticlesAttributes::PathTypeEnum(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetStopPathType(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetStopPathType()));
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetTraceVariableX(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the traceVariableX in the object.
    obj->data->SetTraceVariableX(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetTraceVariableX(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetTraceVariableX().c_str());
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetTraceVariableY(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the traceVariableY in the object.
    obj->data->SetTraceVariableY(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetTraceVariableY(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetTraceVariableY().c_str());
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetTraceVariableZ(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the traceVariableZ in the object.
    obj->data->SetTraceVariableZ(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetTraceVariableZ(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetTraceVariableZ().c_str());
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetConnectParticles(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the connectParticles in the object.
    obj->data->SetConnectParticles(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetConnectParticles(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetConnectParticles()?1L:0L);
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetShowPoints(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the showPoints in the object.
    obj->data->SetShowPoints(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetShowPoints(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetShowPoints()?1L:0L);
    return retval;
}

/*static*/ PyObject *
PersistentParticlesAttributes_SetIndexVariable(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the indexVariable in the object.
    obj->data->SetIndexVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
PersistentParticlesAttributes_GetIndexVariable(PyObject *self, PyObject *args)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetIndexVariable().c_str());
    return retval;
}



PyMethodDef PyPersistentParticlesAttributes_methods[PERSISTENTPARTICLESATTRIBUTES_NMETH] = {
    {"Notify", PersistentParticlesAttributes_Notify, METH_VARARGS},
    {"SetStartIndex", PersistentParticlesAttributes_SetStartIndex, METH_VARARGS},
    {"GetStartIndex", PersistentParticlesAttributes_GetStartIndex, METH_VARARGS},
    {"SetStopIndex", PersistentParticlesAttributes_SetStopIndex, METH_VARARGS},
    {"GetStopIndex", PersistentParticlesAttributes_GetStopIndex, METH_VARARGS},
    {"SetStride", PersistentParticlesAttributes_SetStride, METH_VARARGS},
    {"GetStride", PersistentParticlesAttributes_GetStride, METH_VARARGS},
    {"SetStartPathType", PersistentParticlesAttributes_SetStartPathType, METH_VARARGS},
    {"GetStartPathType", PersistentParticlesAttributes_GetStartPathType, METH_VARARGS},
    {"SetStopPathType", PersistentParticlesAttributes_SetStopPathType, METH_VARARGS},
    {"GetStopPathType", PersistentParticlesAttributes_GetStopPathType, METH_VARARGS},
    {"SetTraceVariableX", PersistentParticlesAttributes_SetTraceVariableX, METH_VARARGS},
    {"GetTraceVariableX", PersistentParticlesAttributes_GetTraceVariableX, METH_VARARGS},
    {"SetTraceVariableY", PersistentParticlesAttributes_SetTraceVariableY, METH_VARARGS},
    {"GetTraceVariableY", PersistentParticlesAttributes_GetTraceVariableY, METH_VARARGS},
    {"SetTraceVariableZ", PersistentParticlesAttributes_SetTraceVariableZ, METH_VARARGS},
    {"GetTraceVariableZ", PersistentParticlesAttributes_GetTraceVariableZ, METH_VARARGS},
    {"SetConnectParticles", PersistentParticlesAttributes_SetConnectParticles, METH_VARARGS},
    {"GetConnectParticles", PersistentParticlesAttributes_GetConnectParticles, METH_VARARGS},
    {"SetShowPoints", PersistentParticlesAttributes_SetShowPoints, METH_VARARGS},
    {"GetShowPoints", PersistentParticlesAttributes_GetShowPoints, METH_VARARGS},
    {"SetIndexVariable", PersistentParticlesAttributes_SetIndexVariable, METH_VARARGS},
    {"GetIndexVariable", PersistentParticlesAttributes_GetIndexVariable, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
PersistentParticlesAttributes_dealloc(PyObject *v)
{
   PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *PersistentParticlesAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyPersistentParticlesAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "startIndex") == 0)
        return PersistentParticlesAttributes_GetStartIndex(self, NULL);
    if(strcmp(name, "stopIndex") == 0)
        return PersistentParticlesAttributes_GetStopIndex(self, NULL);
    if(strcmp(name, "stride") == 0)
        return PersistentParticlesAttributes_GetStride(self, NULL);
    if(strcmp(name, "startPathType") == 0)
        return PersistentParticlesAttributes_GetStartPathType(self, NULL);
    if(strcmp(name, "Absolute") == 0)
        return PyInt_FromLong(long(PersistentParticlesAttributes::Absolute));
    if(strcmp(name, "Relative") == 0)
        return PyInt_FromLong(long(PersistentParticlesAttributes::Relative));

    if(strcmp(name, "stopPathType") == 0)
        return PersistentParticlesAttributes_GetStopPathType(self, NULL);
    if(strcmp(name, "Absolute") == 0)
        return PyInt_FromLong(long(PersistentParticlesAttributes::Absolute));
    if(strcmp(name, "Relative") == 0)
        return PyInt_FromLong(long(PersistentParticlesAttributes::Relative));

    if(strcmp(name, "traceVariableX") == 0)
        return PersistentParticlesAttributes_GetTraceVariableX(self, NULL);
    if(strcmp(name, "traceVariableY") == 0)
        return PersistentParticlesAttributes_GetTraceVariableY(self, NULL);
    if(strcmp(name, "traceVariableZ") == 0)
        return PersistentParticlesAttributes_GetTraceVariableZ(self, NULL);
    if(strcmp(name, "connectParticles") == 0)
        return PersistentParticlesAttributes_GetConnectParticles(self, NULL);
    if(strcmp(name, "showPoints") == 0)
        return PersistentParticlesAttributes_GetShowPoints(self, NULL);
    if(strcmp(name, "indexVariable") == 0)
        return PersistentParticlesAttributes_GetIndexVariable(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyPersistentParticlesAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyPersistentParticlesAttributes_methods[i].ml_name),
                PyString_FromString(PyPersistentParticlesAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyPersistentParticlesAttributes_methods, self, name);
}

int
PyPersistentParticlesAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "startIndex") == 0)
        obj = PersistentParticlesAttributes_SetStartIndex(self, args);
    else if(strcmp(name, "stopIndex") == 0)
        obj = PersistentParticlesAttributes_SetStopIndex(self, args);
    else if(strcmp(name, "stride") == 0)
        obj = PersistentParticlesAttributes_SetStride(self, args);
    else if(strcmp(name, "startPathType") == 0)
        obj = PersistentParticlesAttributes_SetStartPathType(self, args);
    else if(strcmp(name, "stopPathType") == 0)
        obj = PersistentParticlesAttributes_SetStopPathType(self, args);
    else if(strcmp(name, "traceVariableX") == 0)
        obj = PersistentParticlesAttributes_SetTraceVariableX(self, args);
    else if(strcmp(name, "traceVariableY") == 0)
        obj = PersistentParticlesAttributes_SetTraceVariableY(self, args);
    else if(strcmp(name, "traceVariableZ") == 0)
        obj = PersistentParticlesAttributes_SetTraceVariableZ(self, args);
    else if(strcmp(name, "connectParticles") == 0)
        obj = PersistentParticlesAttributes_SetConnectParticles(self, args);
    else if(strcmp(name, "showPoints") == 0)
        obj = PersistentParticlesAttributes_SetShowPoints(self, args);
    else if(strcmp(name, "indexVariable") == 0)
        obj = PersistentParticlesAttributes_SetIndexVariable(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
PersistentParticlesAttributes_print(PyObject *v, FILE *fp, int flags)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)v;
    fprintf(fp, "%s", PyPersistentParticlesAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
PersistentParticlesAttributes_str(PyObject *v)
{
    PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)v;
    return PyString_FromString(PyPersistentParticlesAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *PersistentParticlesAttributes_Purpose = "This class contains attributes for the PersistentParticles operator.";
#else
static char *PersistentParticlesAttributes_Purpose = "This class contains attributes for the PersistentParticles operator.";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(PersistentParticlesAttributesType,         \
                  "PersistentParticlesAttributes",           \
                  PersistentParticlesAttributesObject,       \
                  PersistentParticlesAttributes_dealloc,     \
                  PersistentParticlesAttributes_print,       \
                  PyPersistentParticlesAttributes_getattr,   \
                  PyPersistentParticlesAttributes_setattr,   \
                  PersistentParticlesAttributes_str,         \
                  PersistentParticlesAttributes_Purpose,     \
                  PersistentParticlesAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
PersistentParticlesAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &PersistentParticlesAttributesType
         || Py_TYPE(other) != &PersistentParticlesAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    PersistentParticlesAttributes *a = ((PersistentParticlesAttributesObject *)self)->data;
    PersistentParticlesAttributes *b = ((PersistentParticlesAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static PersistentParticlesAttributes *defaultAtts = 0;
static PersistentParticlesAttributes *currentAtts = 0;

static PyObject *
NewPersistentParticlesAttributes(int useCurrent)
{
    PersistentParticlesAttributesObject *newObject;
    newObject = PyObject_NEW(PersistentParticlesAttributesObject, &PersistentParticlesAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new PersistentParticlesAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new PersistentParticlesAttributes(*defaultAtts);
    else
        newObject->data = new PersistentParticlesAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapPersistentParticlesAttributes(const PersistentParticlesAttributes *attr)
{
    PersistentParticlesAttributesObject *newObject;
    newObject = PyObject_NEW(PersistentParticlesAttributesObject, &PersistentParticlesAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (PersistentParticlesAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
PersistentParticlesAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewPersistentParticlesAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef PersistentParticlesAttributesMethods[] = {
    {"PersistentParticlesAttributes", PersistentParticlesAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *PersistentParticlesAttributesObserver = 0;

std::string
PyPersistentParticlesAttributes_GetLogString()
{
    std::string s("PersistentParticlesAtts = PersistentParticlesAttributes()\n");
    if(currentAtts != 0)
        s += PyPersistentParticlesAttributes_ToString(currentAtts, "PersistentParticlesAtts.", true);
    return s;
}

static void
PyPersistentParticlesAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("PersistentParticlesAtts = PersistentParticlesAttributes()\n");
        s += PyPersistentParticlesAttributes_ToString(currentAtts, "PersistentParticlesAtts.", true);
        cb(s);
    }
}

void
PyPersistentParticlesAttributes_StartUp(PersistentParticlesAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyPersistentParticlesAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(PersistentParticlesAttributesObserver == 0)
    {
        PersistentParticlesAttributesObserver = new ObserverToCallback(subj,
            PyPersistentParticlesAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyPersistentParticlesAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete PersistentParticlesAttributesObserver;
    PersistentParticlesAttributesObserver = 0;
}

PyMethodDef *
PyPersistentParticlesAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return PersistentParticlesAttributesMethods;
}

bool
PyPersistentParticlesAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &PersistentParticlesAttributesType);
}

PersistentParticlesAttributes *
PyPersistentParticlesAttributes_FromPyObject(PyObject *obj)
{
    PersistentParticlesAttributesObject *obj2 = (PersistentParticlesAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyPersistentParticlesAttributes_New()
{
    return NewPersistentParticlesAttributes(0);
}

PyObject *
PyPersistentParticlesAttributes_Wrap(const PersistentParticlesAttributes *attr)
{
    return WrapPersistentParticlesAttributes(attr);
}

void
PyPersistentParticlesAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    PersistentParticlesAttributesObject *obj2 = (PersistentParticlesAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyPersistentParticlesAttributes_SetDefaults(const PersistentParticlesAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new PersistentParticlesAttributes(*atts);
}

